* Code for analyses in Appendix G

* EPSTEIN-O'HALLORAN ANALYSIS **************************************************
use "eo.dta"
* Replication of EO model in book
rreg dis divided
rreg dis divided start_term activist surplus_percent

* Stats for Table 10
summarize dis divided start_term activist surplus_percent

* Table 11
reg dis divided, cluster(agencyfe)
reg dis divided i.agencyfe, cluster(agencyfe)
reg dis divided i.agencyfe hcomm1-hcomm29 scomm1-scomm29, cluster(agencyfe)
reg dis divided unemployment public_approval year1 inflation war i.agencyfe hcomm1-hcomm29 scomm1-scomm29, cluster(agencyfe)

* Generate mean discretion level by agency and s.e. for Figure 2
collapse (mean) dis_mean=dis (sd) dis_std=dis (sum) n=one, by(sigagency)
keep if sigagency == "AG" | sigagency == "CM" | sigagency == "DD" | sigagency == "DJ" | sigagency == "DL" | ///
	sigagency == "DN" | sigagency == "ED" | sigagency == "HE" | sigagency == "HU" | sigagency == "IN" | ///
	sigagency == "ST" | sigagency == "TD" | sigagency == "TR"
gen dis_se = dis_std / sqrt(n)



* BILL LENGTH ANALYSIS *********************************************************
use "bill_length.dta"

* Table 12
reg discretion divided inflation unemp first_year war approval i.commfe if lnbill != ., cluster(commfe)
reg lnbill divided inflation unemp first_year war approval i.commfe, cluster(commfe)


* INDIVIDUAL CONSTRAINTS ANALYSIS **********************************************
use "constraintmeasures.dta"

* Table 13
correl npages_ln lnreports
correl npages_ln lndeadlines
correl npages_ln lnreprogramming
correl npages_ln lnstudy
correl npages_ln lnconsultation
correl discretion lnreports
correl discretion lndeadlines
correl discretion lnreprogramming
correl discretion lnstudy
correl discretion lnconsultation

* Keep same sample across regressions to make comparisons meaningful
gen sample = 0
replace sample = 1 if discretion != . & lnreports != . & lndeadlines != . & lnreprogramming != . & lnstudy != . & lnconsultation != .

* Table 14
reg discretion divided inflation unemp first_year war approval i.agencyfe i.commfe if sample == 1, cluster(agency)
reg lnreports divided inflation unemp first_year war approval i.agencyfe i.commfe if sample == 1, cluster(agency)
reg lndeadlines divided inflation unemp first_year war approval i.agencyfe i.commfe if sample == 1, cluster(agency)
reg lnreprogramming divided inflation unemp first_year war approval i.agencyfe i.commfe if sample == 1, cluster(agency)
reg lnstudy divided inflation unemp first_year war approval i.agencyfe i.commfe if sample == 1, cluster(agency)
reg lnconsultation divided inflation unemp first_year war approval i.agencyfe i.commfe if sample == 1, cluster(agency)




